\(\int \frac {\tanh (c+d x)}{(a+b \tanh ^2(c+d x))^2} \, dx\) [184]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 68 \[ \int \frac {\tanh (c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=\frac {\log (\cosh (c+d x))}{(a+b)^2 d}+\frac {\log \left (a+b \tanh ^2(c+d x)\right )}{2 (a+b)^2 d}-\frac {1}{2 (a+b) d \left (a+b \tanh ^2(c+d x)\right )} \]

[Out]

ln(cosh(d*x+c))/(a+b)^2/d+1/2*ln(a+b*tanh(d*x+c)^2)/(a+b)^2/d-1/2/(a+b)/d/(a+b*tanh(d*x+c)^2)

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 68, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3751, 455, 46} \[ \int \frac {\tanh (c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=-\frac {1}{2 d (a+b) \left (a+b \tanh ^2(c+d x)\right )}+\frac {\log \left (a+b \tanh ^2(c+d x)\right )}{2 d (a+b)^2}+\frac {\log (\cosh (c+d x))}{d (a+b)^2} \]

[In]

Int[Tanh[c + d*x]/(a + b*Tanh[c + d*x]^2)^2,x]

[Out]

Log[Cosh[c + d*x]]/((a + b)^2*d) + Log[a + b*Tanh[c + d*x]^2]/(2*(a + b)^2*d) - 1/(2*(a + b)*d*(a + b*Tanh[c +
 d*x]^2))

Rule 46

Int[((a_) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x
)^n, x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && ILtQ[m, 0] && IntegerQ[n] &&  !(IGtQ[n, 0] && Lt
Q[m + n + 2, 0])

Rule 455

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] && NeQ[b*c - a*d, 0] && EqQ[m
- n + 1, 0]

Rule 3751

Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol]
 :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist[c*(ff/f), Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2
 + ff^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, n, p}, x] && (IGtQ[p, 0] || EqQ
[n, 2] || EqQ[n, 4] || (IntegerQ[p] && RationalQ[n]))

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {x}{\left (1-x^2\right ) \left (a+b x^2\right )^2} \, dx,x,\tanh (c+d x)\right )}{d} \\ & = \frac {\text {Subst}\left (\int \frac {1}{(1-x) (a+b x)^2} \, dx,x,\tanh ^2(c+d x)\right )}{2 d} \\ & = \frac {\text {Subst}\left (\int \left (-\frac {1}{(a+b)^2 (-1+x)}+\frac {b}{(a+b) (a+b x)^2}+\frac {b}{(a+b)^2 (a+b x)}\right ) \, dx,x,\tanh ^2(c+d x)\right )}{2 d} \\ & = \frac {\log (\cosh (c+d x))}{(a+b)^2 d}+\frac {\log \left (a+b \tanh ^2(c+d x)\right )}{2 (a+b)^2 d}-\frac {1}{2 (a+b) d \left (a+b \tanh ^2(c+d x)\right )} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.45 (sec) , antiderivative size = 55, normalized size of antiderivative = 0.81 \[ \int \frac {\tanh (c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=-\frac {-2 \log (\cosh (c+d x))-\log \left (a+b \tanh ^2(c+d x)\right )+\frac {a+b}{a+b \tanh ^2(c+d x)}}{2 (a+b)^2 d} \]

[In]

Integrate[Tanh[c + d*x]/(a + b*Tanh[c + d*x]^2)^2,x]

[Out]

-1/2*(-2*Log[Cosh[c + d*x]] - Log[a + b*Tanh[c + d*x]^2] + (a + b)/(a + b*Tanh[c + d*x]^2))/((a + b)^2*d)

Maple [A] (verified)

Time = 0.10 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.26

method result size
derivativedivides \(\frac {\frac {b \left (-\frac {a +b}{b \left (a +b \tanh \left (d x +c \right )^{2}\right )}+\frac {\ln \left (a +b \tanh \left (d x +c \right )^{2}\right )}{b}\right )}{2 \left (a +b \right )^{2}}-\frac {\ln \left (\tanh \left (d x +c \right )+1\right )}{2 \left (a +b \right )^{2}}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right )}{2 \left (a +b \right )^{2}}}{d}\) \(86\)
default \(\frac {\frac {b \left (-\frac {a +b}{b \left (a +b \tanh \left (d x +c \right )^{2}\right )}+\frac {\ln \left (a +b \tanh \left (d x +c \right )^{2}\right )}{b}\right )}{2 \left (a +b \right )^{2}}-\frac {\ln \left (\tanh \left (d x +c \right )+1\right )}{2 \left (a +b \right )^{2}}-\frac {\ln \left (\tanh \left (d x +c \right )-1\right )}{2 \left (a +b \right )^{2}}}{d}\) \(86\)
parallelrisch \(-\frac {-\tanh \left (d x +c \right )^{2} a b -a^{2} \ln \left (a +b \tanh \left (d x +c \right )^{2}\right )-b^{2} \tanh \left (d x +c \right )^{2}+2 a^{2} d x -\ln \left (a +b \tanh \left (d x +c \right )^{2}\right ) \tanh \left (d x +c \right )^{2} a b +2 \ln \left (1-\tanh \left (d x +c \right )\right ) a^{2}+2 x \tanh \left (d x +c \right )^{2} a b d +2 \ln \left (1-\tanh \left (d x +c \right )\right ) \tanh \left (d x +c \right )^{2} a b}{2 \left (a +b \tanh \left (d x +c \right )^{2}\right ) d \left (a +b \right )^{2} a}\) \(157\)
risch \(-\frac {x}{a^{2}+2 a b +b^{2}}-\frac {2 c}{d \left (a^{2}+2 a b +b^{2}\right )}-\frac {2 b \,{\mathrm e}^{2 d x +2 c}}{d \left (a +b \right )^{2} \left (a \,{\mathrm e}^{4 d x +4 c}+b \,{\mathrm e}^{4 d x +4 c}+2 \,{\mathrm e}^{2 d x +2 c} a -2 b \,{\mathrm e}^{2 d x +2 c}+a +b \right )}+\frac {\ln \left ({\mathrm e}^{4 d x +4 c}+\frac {2 \left (a -b \right ) {\mathrm e}^{2 d x +2 c}}{a +b}+1\right )}{2 d \left (a^{2}+2 a b +b^{2}\right )}\) \(159\)

[In]

int(tanh(d*x+c)/(a+b*tanh(d*x+c)^2)^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(1/2*b/(a+b)^2*(-(a+b)/b/(a+b*tanh(d*x+c)^2)+1/b*ln(a+b*tanh(d*x+c)^2))-1/2/(a+b)^2*ln(tanh(d*x+c)+1)-1/2/
(a+b)^2*ln(tanh(d*x+c)-1))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 623 vs. \(2 (64) = 128\).

Time = 0.28 (sec) , antiderivative size = 623, normalized size of antiderivative = 9.16 \[ \int \frac {\tanh (c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=-\frac {2 \, {\left (a + b\right )} d x \cosh \left (d x + c\right )^{4} + 8 \, {\left (a + b\right )} d x \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + 2 \, {\left (a + b\right )} d x \sinh \left (d x + c\right )^{4} + 2 \, {\left (a + b\right )} d x + 4 \, {\left ({\left (a - b\right )} d x + b\right )} \cosh \left (d x + c\right )^{2} + 4 \, {\left (3 \, {\left (a + b\right )} d x \cosh \left (d x + c\right )^{2} + {\left (a - b\right )} d x + b\right )} \sinh \left (d x + c\right )^{2} - {\left ({\left (a + b\right )} \cosh \left (d x + c\right )^{4} + 4 \, {\left (a + b\right )} \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + {\left (a + b\right )} \sinh \left (d x + c\right )^{4} + 2 \, {\left (a - b\right )} \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, {\left (a + b\right )} \cosh \left (d x + c\right )^{2} + a - b\right )} \sinh \left (d x + c\right )^{2} + 4 \, {\left ({\left (a + b\right )} \cosh \left (d x + c\right )^{3} + {\left (a - b\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right ) + a + b\right )} \log \left (\frac {2 \, {\left ({\left (a + b\right )} \cosh \left (d x + c\right )^{2} + {\left (a + b\right )} \sinh \left (d x + c\right )^{2} + a - b\right )}}{\cosh \left (d x + c\right )^{2} - 2 \, \cosh \left (d x + c\right ) \sinh \left (d x + c\right ) + \sinh \left (d x + c\right )^{2}}\right ) + 8 \, {\left ({\left (a + b\right )} d x \cosh \left (d x + c\right )^{3} + {\left ({\left (a - b\right )} d x + b\right )} \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right )}{2 \, {\left ({\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}\right )} d \cosh \left (d x + c\right )^{4} + 4 \, {\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}\right )} d \cosh \left (d x + c\right ) \sinh \left (d x + c\right )^{3} + {\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}\right )} d \sinh \left (d x + c\right )^{4} + 2 \, {\left (a^{3} + a^{2} b - a b^{2} - b^{3}\right )} d \cosh \left (d x + c\right )^{2} + 2 \, {\left (3 \, {\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}\right )} d \cosh \left (d x + c\right )^{2} + {\left (a^{3} + a^{2} b - a b^{2} - b^{3}\right )} d\right )} \sinh \left (d x + c\right )^{2} + {\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}\right )} d + 4 \, {\left ({\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}\right )} d \cosh \left (d x + c\right )^{3} + {\left (a^{3} + a^{2} b - a b^{2} - b^{3}\right )} d \cosh \left (d x + c\right )\right )} \sinh \left (d x + c\right )\right )}} \]

[In]

integrate(tanh(d*x+c)/(a+b*tanh(d*x+c)^2)^2,x, algorithm="fricas")

[Out]

-1/2*(2*(a + b)*d*x*cosh(d*x + c)^4 + 8*(a + b)*d*x*cosh(d*x + c)*sinh(d*x + c)^3 + 2*(a + b)*d*x*sinh(d*x + c
)^4 + 2*(a + b)*d*x + 4*((a - b)*d*x + b)*cosh(d*x + c)^2 + 4*(3*(a + b)*d*x*cosh(d*x + c)^2 + (a - b)*d*x + b
)*sinh(d*x + c)^2 - ((a + b)*cosh(d*x + c)^4 + 4*(a + b)*cosh(d*x + c)*sinh(d*x + c)^3 + (a + b)*sinh(d*x + c)
^4 + 2*(a - b)*cosh(d*x + c)^2 + 2*(3*(a + b)*cosh(d*x + c)^2 + a - b)*sinh(d*x + c)^2 + 4*((a + b)*cosh(d*x +
 c)^3 + (a - b)*cosh(d*x + c))*sinh(d*x + c) + a + b)*log(2*((a + b)*cosh(d*x + c)^2 + (a + b)*sinh(d*x + c)^2
 + a - b)/(cosh(d*x + c)^2 - 2*cosh(d*x + c)*sinh(d*x + c) + sinh(d*x + c)^2)) + 8*((a + b)*d*x*cosh(d*x + c)^
3 + ((a - b)*d*x + b)*cosh(d*x + c))*sinh(d*x + c))/((a^3 + 3*a^2*b + 3*a*b^2 + b^3)*d*cosh(d*x + c)^4 + 4*(a^
3 + 3*a^2*b + 3*a*b^2 + b^3)*d*cosh(d*x + c)*sinh(d*x + c)^3 + (a^3 + 3*a^2*b + 3*a*b^2 + b^3)*d*sinh(d*x + c)
^4 + 2*(a^3 + a^2*b - a*b^2 - b^3)*d*cosh(d*x + c)^2 + 2*(3*(a^3 + 3*a^2*b + 3*a*b^2 + b^3)*d*cosh(d*x + c)^2
+ (a^3 + a^2*b - a*b^2 - b^3)*d)*sinh(d*x + c)^2 + (a^3 + 3*a^2*b + 3*a*b^2 + b^3)*d + 4*((a^3 + 3*a^2*b + 3*a
*b^2 + b^3)*d*cosh(d*x + c)^3 + (a^3 + a^2*b - a*b^2 - b^3)*d*cosh(d*x + c))*sinh(d*x + c))

Sympy [A] (verification not implemented)

Time = 58.58 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.35 \[ \int \frac {\tanh (c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=\frac {b \left (\begin {cases} \frac {\tanh ^{2}{\left (c + d x \right )}}{a^{2}} & \text {for}\: b = 0 \\- \frac {1}{b \left (a + b \tanh ^{2}{\left (c + d x \right )}\right )} & \text {otherwise} \end {cases}\right )}{2 d \left (a + b\right )} + \frac {b \left (\begin {cases} \frac {\tanh ^{2}{\left (c + d x \right )}}{a} & \text {for}\: b = 0 \\\frac {\log {\left (a + b \tanh ^{2}{\left (c + d x \right )} \right )}}{b} & \text {otherwise} \end {cases}\right )}{2 d \left (a + b\right )^{2}} - \frac {\log {\left (\tanh ^{2}{\left (c + d x \right )} - 1 \right )}}{2 d \left (a + b\right )^{2}} \]

[In]

integrate(tanh(d*x+c)/(a+b*tanh(d*x+c)**2)**2,x)

[Out]

b*Piecewise((tanh(c + d*x)**2/a**2, Eq(b, 0)), (-1/(b*(a + b*tanh(c + d*x)**2)), True))/(2*d*(a + b)) + b*Piec
ewise((tanh(c + d*x)**2/a, Eq(b, 0)), (log(a + b*tanh(c + d*x)**2)/b, True))/(2*d*(a + b)**2) - log(tanh(c + d
*x)**2 - 1)/(2*d*(a + b)**2)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 170 vs. \(2 (64) = 128\).

Time = 0.22 (sec) , antiderivative size = 170, normalized size of antiderivative = 2.50 \[ \int \frac {\tanh (c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=-\frac {2 \, b e^{\left (-2 \, d x - 2 \, c\right )}}{{\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3} + 2 \, {\left (a^{3} + a^{2} b - a b^{2} - b^{3}\right )} e^{\left (-2 \, d x - 2 \, c\right )} + {\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}\right )} e^{\left (-4 \, d x - 4 \, c\right )}\right )} d} + \frac {d x + c}{{\left (a^{2} + 2 \, a b + b^{2}\right )} d} + \frac {\log \left (2 \, {\left (a - b\right )} e^{\left (-2 \, d x - 2 \, c\right )} + {\left (a + b\right )} e^{\left (-4 \, d x - 4 \, c\right )} + a + b\right )}{2 \, {\left (a^{2} + 2 \, a b + b^{2}\right )} d} \]

[In]

integrate(tanh(d*x+c)/(a+b*tanh(d*x+c)^2)^2,x, algorithm="maxima")

[Out]

-2*b*e^(-2*d*x - 2*c)/((a^3 + 3*a^2*b + 3*a*b^2 + b^3 + 2*(a^3 + a^2*b - a*b^2 - b^3)*e^(-2*d*x - 2*c) + (a^3
+ 3*a^2*b + 3*a*b^2 + b^3)*e^(-4*d*x - 4*c))*d) + (d*x + c)/((a^2 + 2*a*b + b^2)*d) + 1/2*log(2*(a - b)*e^(-2*
d*x - 2*c) + (a + b)*e^(-4*d*x - 4*c) + a + b)/((a^2 + 2*a*b + b^2)*d)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 149 vs. \(2 (64) = 128\).

Time = 0.34 (sec) , antiderivative size = 149, normalized size of antiderivative = 2.19 \[ \int \frac {\tanh (c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=\frac {\frac {\log \left ({\left | a {\left (e^{\left (2 \, d x + 2 \, c\right )} + e^{\left (-2 \, d x - 2 \, c\right )}\right )} + b {\left (e^{\left (2 \, d x + 2 \, c\right )} + e^{\left (-2 \, d x - 2 \, c\right )}\right )} + 2 \, a - 2 \, b \right |}\right )}{a^{2} + 2 \, a b + b^{2}} - \frac {e^{\left (2 \, d x + 2 \, c\right )} + e^{\left (-2 \, d x - 2 \, c\right )} + 2}{{\left (a {\left (e^{\left (2 \, d x + 2 \, c\right )} + e^{\left (-2 \, d x - 2 \, c\right )}\right )} + b {\left (e^{\left (2 \, d x + 2 \, c\right )} + e^{\left (-2 \, d x - 2 \, c\right )}\right )} + 2 \, a - 2 \, b\right )} {\left (a + b\right )}}}{2 \, d} \]

[In]

integrate(tanh(d*x+c)/(a+b*tanh(d*x+c)^2)^2,x, algorithm="giac")

[Out]

1/2*(log(abs(a*(e^(2*d*x + 2*c) + e^(-2*d*x - 2*c)) + b*(e^(2*d*x + 2*c) + e^(-2*d*x - 2*c)) + 2*a - 2*b))/(a^
2 + 2*a*b + b^2) - (e^(2*d*x + 2*c) + e^(-2*d*x - 2*c) + 2)/((a*(e^(2*d*x + 2*c) + e^(-2*d*x - 2*c)) + b*(e^(2
*d*x + 2*c) + e^(-2*d*x - 2*c)) + 2*a - 2*b)*(a + b)))/d

Mupad [B] (verification not implemented)

Time = 2.05 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.90 \[ \int \frac {\tanh (c+d x)}{\left (a+b \tanh ^2(c+d x)\right )^2} \, dx=\frac {\frac {a\,x}{a^2+2\,a\,b+b^2}+\frac {b\,x\,{\mathrm {tanh}\left (c+d\,x\right )}^2}{a^2+2\,a\,b+b^2}+\frac {b\,{\mathrm {tanh}\left (c+d\,x\right )}^2}{2\,a\,d\,\left (a+b\right )}}{b\,{\mathrm {tanh}\left (c+d\,x\right )}^2+a}+\frac {\ln \left (b\,{\mathrm {tanh}\left (c+d\,x\right )}^2+a\right )}{2\,d\,\left (a^2+2\,a\,b+b^2\right )}-\frac {\ln \left (\mathrm {tanh}\left (c+d\,x\right )+1\right )}{d\,{\left (a+b\right )}^2} \]

[In]

int(tanh(c + d*x)/(a + b*tanh(c + d*x)^2)^2,x)

[Out]

((a*x)/(2*a*b + a^2 + b^2) + (b*x*tanh(c + d*x)^2)/(2*a*b + a^2 + b^2) + (b*tanh(c + d*x)^2)/(2*a*d*(a + b)))/
(a + b*tanh(c + d*x)^2) + log(a + b*tanh(c + d*x)^2)/(2*d*(2*a*b + a^2 + b^2)) - log(tanh(c + d*x) + 1)/(d*(a
+ b)^2)